namespace Csharp01._0928;

public class Demo
{
    public void Test1()
    {
        
        for (int i = 2; i <= 100; i++)
        {
            bool isPrime = true;
        
            for (int j = 2; j <= Math.Sqrt(i); j++)
            {
                if (i % j == 0)
                {
                    isPrime = false;
                    break;
                }
            }
            if (isPrime)
            {
                Console.WriteLine(i);
            }
        }
    }
    public void Test2()  
    {
        Console.WriteLine("100到999之间的水仙花数：");
        for (int i = 100; i <= 999; i++)
        {
            int hundreds = i / 100;        
            int tens = (i / 10) % 10;     
            int units = i % 10;           
            
            if (i == (hundreds * hundreds * hundreds + tens * tens * tens + units * units * units))
            {
                Console.WriteLine(i);
            }
        }
    }
}